import requests as http
import console
http.DEFAULT_RETRIES = 5  # 增加重试连接次数
s = http.session()
s.keep_alive = False  # 关闭多余连接


def get(url, params=None, **kwargs) -> object:
    while 1:
        try:
            response = http.get(url, params, **kwargs)
            return response
        except (http.exceptions.RequestException, http.exceptions.ConnecionError, http.exceptions.ProxyError) as e:
            console.error(e)


def post(url, data=None, json=None, **kwargs) -> object:
    while 1:
        try:
            response = http.post(url, data, json, **kwargs)
            return response
        except (http.exceptions.RequestException, http.exceptions.ConnecionError, http.exceptions.ProxyError) as e:
            console.error(e)


def download() -> object:
    print('wait for coding')